<template>
  <view class="all1">
    <view class="input">
      <view class="uni-container">
        <view class="wsj" v-if="tableData == ''">暂未发现优惠券</view>
        <view class="list" v-for="(item,index) in tableData" :key="index">
          <view>
            <view class="l-i">
						<span class="spanli">
							<view class="li"></view>
							<view>姓名</view>
						</span>：<span style="font-weight: bold;">{{item.name}}</span>
            </view>
            <view class="l-i"><span class="spanli">
							<view class="li"></view>
							<view>金额</view>
						</span>：<span style="color:#F9363A;font-weight: bold;">{{item.amount}}</span>元</view>
            <view style="display: flex; justify-content: space-between;">
              <view class="l-i"><span class="spanli">
								<view class="li"></view>
								<view>创建日期</view>
							</span>：{{item.createTime}}</view>
            </view>
          </view>
          </view>
      </view>
      <view class="uni-pagination-box">
        <uni-pagination show-icon :page-size="pageSize" :current="pageCurrent"
                        :total="total" @change="change"/>
      </view>
    </view>
  </view>
  <!--  </view>-->
</template>


<script>
import {
  Supplierqueryall,
  Supplierlikeall
} from '@/common/api.js'

export default {
  data() {
    return {
      value: '',
      fromData: {
        companyId: ''
      },
      from: {
        companyId: "",
        like: ""
      },
      tableData: '',
      // 每页数据量
      pageSize: 10,
      // 当前页
      pageCurrent: 1,
      // 数据总量
      total: 0,
      loading: false
    }
  },
  onLoad() {
    this.getData()
  },
  methods: {
    changkeyword(e) {
      console.log(e);
    },
    presa() {
      this.getData()
    },
    onQuery() {
      console.log(this.value);
      this.from.companyId = uni.getStorageSync('companyId');
      this.from.like = this.value;
      uni.showLoading({
        title: '加载中...',
      });
      Supplierlikeall(this.from).then((res) => {
        uni.hideLoading();
        console.log('---------------------');
        console.log(res);
        this.tableData = res.data
      })
    },
    // 获取数据
    getData() {
      this.loading = true
      this.fromData.companyId = uni.getStorageSync('companyId');
      console.log(this.fromData);
      Supplierqueryall(this.fromData).then((res) => {
        console.log(res.data);
        this.loading = false;
        this.tableData = res.data
      })
    },

  },
}
</script>


<style>

.all1 {
  width: 750rpx;
  background-color: #F5F4F4;
  height: 100vh;
  overflow: auto;
}
.spanli {
  color: #046BFB;
  display: flex;
  align-items: center;
  font-weight: bold;
}

.l-i {
  display: flex;
  margin-bottom: 10rpx;
}


.li {
  width: 15rpx;
  height: 15rpx;
  border: 4rpx solid #046BFB;
  border-radius: 50%;
  margin-right: 10rpx;
}

.uni-button {
  height: fit-content;
}

.input {
  padding: 30rpx;
}

.formlist {
  /* margin: 420rpx 30rpx 0 30rpx; */
  /* background-color: white; */
  padding: 30rpx;
  border-radius: 30rpx;
}

.lable {
  font-size: 30rpx;
  font-weight: bold;
}

.uni-btn-v {
  width: 100%;
  height: 80rpx;
  line-height: 80rpx;
  background-color: #24d4b0;
  color: #fff;
  font-size: 35rpx;
  font-weight: bold;
  border-radius: 30rpx;
  text-align: center;
  margin-top: 30rpx;
}

.list {
  border-radius: 30rpx;
  box-sizing: border-box;
  padding: 30rpx;
  margin-bottom: 20rpx;
  background-color: white;
  margin-top: 9px;

}

.wsj{
  text-align: center;
  line-height: 200px;
}
</style>
